package cn.iocoder.yudao.module.bpm.service.journalapply.listener;

import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener;
import cn.iocoder.yudao.module.bpm.service.journalapply.JournalApplyService;
import cn.iocoder.yudao.module.bpm.service.journalapply.JournalApplyServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * OA 请假单的结果的监听器实现类
 *
 * @author 源码
 */
@Component
public class journalApplyStatusListener extends BpmProcessInstanceStatusEventListener {

    @Resource
    private JournalApplyService journalApplyService;

    @Override
    protected String getProcessDefinitionKey() {
        return JournalApplyServiceImpl.PROCESS_KEY;
    }

    @Override
    protected void onEvent(BpmProcessInstanceStatusEvent event) {
        journalApplyService.updateLeaveStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
    }

}
